package vista;

import java.awt.event.ActionListener;
import javax.swing.BorderFactory;


import javax.swing.ImageIcon;
import javax.swing.JButton;

import javax.swing.JLabel;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;


import javax.swing.WindowConstants;
import javax.swing.border.BevelBorder;


import javax.swing.table.AbstractTableModel;




/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaConsultaProducto extends javax.swing.JFrame {


	private JPanel jpanConsulta;
	private JTable jtblConsulta;
	private JButton jbtnDescendente;
	private JButton jbtnAscendente;
	private JButton jbtnImagen;
	private JButton jbtnSalir;
	private JScrollPane jScrollPaneConsulta;
	private JLabel jlbltitulo;

	public VentanaConsultaProducto() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			getContentPane().setBackground(new java.awt.Color(82,209,232));
			{
				jpanConsulta = new JPanel();
				getContentPane().add(jpanConsulta, "Center");
				jpanConsulta.setLayout(null);
				jpanConsulta.setBounds(12, 12, 813, 285);
				jpanConsulta.setBackground(new java.awt.Color(255,255,255));
				{
					jlbltitulo = new JLabel();
					jpanConsulta.add(jlbltitulo);
					jlbltitulo.setText("Venta de Productos");
					jlbltitulo.setBounds(18, 40, 771, 28);
					jlbltitulo.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
					jlbltitulo.setBackground(new java.awt.Color(82,209,232));
				}
				{
					jScrollPaneConsulta = new JScrollPane();
					jpanConsulta.add(jScrollPaneConsulta);
					jScrollPaneConsulta.setBounds(204, 85, 423, 170);
					{
						
						jtblConsulta = new JTable();
						jScrollPaneConsulta.setViewportView(jtblConsulta);
						jtblConsulta.setPreferredSize(new java.awt.Dimension(326, 168));
						
					}
				}
				{
					jbtnSalir = new JButton();
					jpanConsulta.add(jbtnSalir);
					jbtnSalir.setText("Salir");
					jbtnSalir.setBounds(680, 230, 103, 25);
					jbtnSalir.setBackground(new java.awt.Color(82,209,232));
					jbtnSalir.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
				}
				{
					jbtnImagen = new JButton();
					jbtnImagen.setIcon(new ImageIcon(getClass().getClassLoader().getResource("imagen.jpg")));
					jpanConsulta.add(jbtnImagen);
					jbtnImagen.setBounds(18, 97, 180, 152);
					jbtnImagen.setBackground(new java.awt.Color(82,209,232));
					jbtnImagen.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
				}
				{
					jbtnAscendente = new JButton();
					jpanConsulta.add(jbtnAscendente);
					jbtnAscendente.setText("Consulta Ascendente");
					jbtnAscendente.setBounds(633, 135, 157, 22);
					jbtnAscendente.setBackground(new java.awt.Color(82,209,232));
					jbtnAscendente.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
				}
				{
					jbtnDescendente = new JButton();
					jpanConsulta.add(jbtnDescendente);
					jbtnDescendente.setText("Consulta Descendente");
					jbtnDescendente.setBounds(633, 182, 157, 22);
					jbtnDescendente.setBackground(new java.awt.Color(82,209,232));
					jbtnDescendente.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
				}
			}
			pack();
			this.setSize(847, 339);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	public void addListener(ActionListener actionListener) {
		this.jbtnAscendente.addActionListener(actionListener);
		this.jbtnDescendente.addActionListener(actionListener);
		this.jbtnSalir.addActionListener(actionListener);
	}
	
	public void setResultados(AbstractTableModel abstractTableModel) {
		jtblConsulta.setModel(abstractTableModel);
	}

}
